package net.framework.smc.kotlin.demokotlin.service

import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.kafka.core.KafkaTemplate
import org.springframework.stereotype.Service

/**
 *  @authore zyx
 *  @date 2018/7/5 17:26
 */
@Service
class SendService {

    companion object {
        val log = LoggerFactory.getLogger(SendService::class.java)
    }

    @Autowired
    lateinit var kafkaTemplate : KafkaTemplate<String, String>


    fun send(msg: String) {
        var future = kafkaTemplate.send("test0622", msg)
        future.addCallback({ log.info("发送完毕")},{ log.info("发送失败")})
    }
}